#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2025/1/11
# @Author : Joker
# @Version : Python 3.7
# @Software: PyCharm

import requests
import settings as conf


class RequestUtil:

    session = requests.Session()

    def request(self, **kwargs):
        # 为请求添加公共的参数,下面是示例
        if kwargs.get("params"):
            kwargs["params"].update(conf.PublicArgs)

        # 处理上传文件的传参,只传路径
        if kwargs.get("files"):
            files_value = kwargs["files"]
            for key, value in files_value.items():
                files_value[key] = open(value, 'rb')

        return self.session.request(**kwargs)


requestUtil = RequestUtil()
